<template>
  <div class="left shadow-parmary">
    <!-- <el-radio-group v-model="isCollapse" style="margin-bottom: 20px;">
      <el-radio-button :label="false">展开</el-radio-button>
      <el-radio-button :label="true">收起</el-radio-button>
    </el-radio-group>-->
    <el-menu class="el-menu-vertical-demo" :router="true" :default-active="$route.path">
      <el-submenu index="1" v-if="type == '0'">
        <template slot="title">
          <i class="el-icon-s-custom"></i>
          <span slot="title">管理员管理</span>
        </template>
        <el-menu-item-group>
          <!-- <span slot="title">管理员操作</span> -->
          <el-menu-item index="/index/manageList">管理员列表</el-menu-item>
          <el-menu-item
            index="/index/manageCreate"
          >{{Object.keys(this.$route.query).length == 0 ? '添加':'修改'}}管理员</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="2" v-if="type != '2'">
        <template slot="title">
          <i class="el-icon-user"></i>
          <span slot="title">用户管理</span>
        </template>
        <el-menu-item-group>
          <!-- <span slot="title">管理员操作</span> -->
          <el-menu-item index="/index/userList">用户列表</el-menu-item>
          <el-menu-item
            index="/index/userCreate"
          >{{Object.keys(this.$route.query).length == 0 ? '添加':'修改'}}用户</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-menu-item index="/index/news">
        <i class="el-icon-info"></i>
        <span slot="title">通知</span>
      </el-menu-item>
      <el-menu-item index="/index/device">
        <i class="el-icon-s-platform"></i>
        <span slot="title">设备管理</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>
<script>
export default {
  data() {
    return {
      type: "",
      isCollapse: true
    };
  },
  watch: {},
  computed: {},
  mounted() {
    // try {
    //   this.type = JSON.parse(localStorage.getItem("user")).type;
    // } catch (ex) {
    //   console.log("请先登录");
    // }
    this.type = JSON.parse(localStorage.getItem("user")).type;
  },
  methods: {}
};
</script>
<style lang="stylus" scoped>
@import '../../common/css/index.styl';

.left {
  width: 240px;
  height: 100%;
  overflow-y: auto;
}

.left >>> .el-menu-item-group__title {
  padding: 0;
}

.left >>> .el-menu {
  border: none;
}
</style>